namespace launch {
namespace cframework
{ 
    using System.Collections;
    

    using UnityEngine;

    public static class CoroutineWithResult
    {
        public static IEnumerator WithResult(this IEnumerator co)
        {
            bool first = true;
            while (co.Current == null || co.Current is IEnumerator || co.Current is YieldInstruction)
            {
                if (!first)
                {
                    yield return co.Current;
                }

                first = false;

                if (!co.MoveNext())
                {
                    yield break;
                }
            }

            yield return co.Current;
        }
    }
}
}